package com.example.leon.demo.Activity;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.leon.demo.R;
import com.example.leon.demo.common.ActivityCollector;
import com.example.leon.demo.common.BaseActivity;

/**
 * Created by leon on 2016/3/26.
 */
public class ThirdActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);

        super.setContentView(R.layout.third_activity);

        Button btn3=(Button) findViewById(R.id.btn3);
        btn3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                //使用系统浏览器打开网页
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("http://www.baidu.com"));
                startActivity(intent);
            }
        });

        Button btn4=(Button) findViewById(R.id.btn4);
        btn4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                //拨打电话
                Intent intent=new Intent(Intent.ACTION_DIAL);
                intent.setData(Uri.parse("tel:18117546319"));
                startActivity(intent);
            }
        });


    }

    @Override
    public void onBackPressed(){
        ActivityCollector.finishAll();
    }
}
